﻿using Autofac;
using System.Reflection;

namespace Tracetothesource.Models
{
    public class AutofacConfig : Autofac.Module
    {

        protected override void Load(ContainerBuilder builder)
        {
            var rep = Assembly.Load("Repository");
            var ser = Assembly.Load("Services");
            builder.RegisterAssemblyTypes(rep).Where(x => x.Name.EndsWith("Repository")).AsImplementedInterfaces();
            builder.RegisterAssemblyTypes(ser).Where(x => x.Name.EndsWith("Services")).AsImplementedInterfaces();
            base.Load(builder);
        }
    }
}
